Base class for a resource in the component. More...
Public Member Functions | |
| Resource () | |
| Resource (const nkMemory::StringView &path) | |
| virtual | ~Resource () |
| virtual bool | load ()=0 |
| virtual void | unload ()=0 |
| bool | isReadyForRendering () const |
| bool | isUnloaded () const |
| RESOURCE_LOAD_STATE | getLoadState () const |
| nkMemory::StringView | getResourcePath () const |
| RESOURCE_TYPE | getResourceTypeName () const |
| nkMemory::StringView | getResourceName () const |
| bool | getHidden () const |
| virtual void | setResourcePath (const nkMemory::StringView &path) |
| void | setResourceName (const nkMemory::StringView &name) |
| void | setHidden (bool value) |
Base class for a resource in the component.
| nkGraphics::Resource::Resource | ( | ) |
Default constructor.
| nkGraphics::Resource::Resource | ( | const nkMemory::StringView & | path | ) |
Filling constructor.
| path | The path of the resource. |
|
virtual |
Destructor.
|
pure virtual |
Loading function. A resource goes into different states through its lifetime.
It is possible to loop through these states during the resource lifetime, if needed.
Implemented in nkGraphics::Program, and nkGraphics::Shader.
|
pure virtual |
Unloads the resource, and places it back into its created state. Frees all internal memory used to initialize it.
Implemented in nkGraphics::Program, and nkGraphics::Shader.
| bool nkGraphics::Resource::isReadyForRendering | ( | ) | const |
| bool nkGraphics::Resource::isUnloaded | ( | ) | const |
| RESOURCE_LOAD_STATE nkGraphics::Resource::getLoadState | ( | ) | const |
The current load state of the resource.
| nkMemory::StringView nkGraphics::Resource::getResourcePath | ( | ) | const |
| RESOURCE_TYPE nkGraphics::Resource::getResourceTypeName | ( | ) | const |
| nkMemory::StringView nkGraphics::Resource::getResourceName | ( | ) | const |
| bool nkGraphics::Resource::getHidden | ( | ) | const |
|
virtual |
Sets the resource's path, relative to the working directory. See nkResources::ResourceManager for path naming conventions.
| path | The path to use. |
Reimplemented in nkGraphics::Texture.
| void nkGraphics::Resource::setResourceName | ( | const nkMemory::StringView & | name | ) |
Sets the resource name.
| name | The resource name to use. |
| void nkGraphics::Resource::setHidden | ( | bool | value | ) |
Sets whether the resource is hidden or not. Hidden resource do not contribute to resource set save requests.
| value | Whether the resource should be hidden (true) or not (false). |